package com.hclc.config.aop;

import com.hclc.config.context.AppContext;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 清除ThreadLocal
 * @ClassName OperationLogAspect
 * @Author: yurj
 * @Mail：1638234804@qq.com
 * @Date: Create in 9:40 2020-3-19
 * @version: 1.0
 */
@Aspect
@Component
public class ThreadAspect {

    //连接点是所有的controller
    @Pointcut("within(com.hclc.yxb.controller.*)")
    private void webPointcut() {
    }

    @After("webPointcut()")
    public void afterProcess(JoinPoint joinPoint) {
        // 清除当前线程变量
        AppContext.clearThreadLocal();
    }
}
